package com.sky.es.service;

import com.sky.es.bean.NewsIndexTypeBean;
import com.sky.es.bean.PersonalIndexTypeBean;
import com.sky.es.util.PageResultDto;
import org.springframework.data.domain.Page;

import java.util.List;

public interface IElasticsearchService {
    void insert();

    void batchInsert();

    void insertNew();

    /**
     * 采用elasticsearchTemplate
     * @param id
     * @return
     */
    PersonalIndexTypeBean findById(Integer id);

    /**
     *
     * @param indexName
     * @param id
     * @return json字符串
     */
    String findById(String indexName, String id);

    boolean updateIndexByQuery(String indexName, String fieldName, String value);

    boolean deleteIndexByQuery(String indexName, String fieldName, String value);

    Page<PersonalIndexTypeBean> findByBlogIdPage(String title, String key, Integer start, Integer end, Integer page, Integer size);

    List<PersonalIndexTypeBean> findByKey(String title, Long blogId, String summary);

    PageResultDto<List<PersonalIndexTypeBean>> findPageResult(Integer start, Integer end, Integer page, Integer size);

    boolean deleteIndex();

    boolean updateIndex();

    Long getCount(String indexName);

    List<NewsIndexTypeBean> findAll(String indexName);

   void createIndexAndMapping();

   void batchCreateIndex();
}
